#ifndef  	__IPZ_ZBC_EXPOSURE_H_
#define		__IPZ_ZBC_EXPOSURE_H_

#ifdef	IPZ_ZBC_EXPOSURE_GLOBAL
	#define	EXPOSURE_EXT	
#else
	#define	EXPOSURE_EXT		extern
#endif



typedef enum _IPZ_ZBC_EXPOSURE_IRIS_STATUS
{
    IPZ_ZBC_EXPOSURE_IRIS_CALIB_PRE,
    IPZ_ZBC_EXPOSURE_IRIS_CALIB_DOWN,
    IPZ_ZBC_EXPOSURE_IRIS_CALIB_UP,
    IPZ_ZBC_EXPOSURE_IRIS_AUTO,
    IPZ_ZBC_EXPOSURE_IRIS_MANU,              /* 光圈优先或全手动 */
    IPZ_ZBC_EXPOSURE_IRIS_SHUTTER_FIRST,
    IPZ_ZBC_EXPOSURE_IRIS_BUTT
}IPZ_ZBC_EXPOSURE_IRIS_STATUS;

typedef struct _IPZ_ZBC_EXPOSURE_ATTR
{
    SW_BOOL         bEnIris;
    SW_BOOL         bAutoIris;

}IPZ_ZBC_EXPOSURE_ATTR;

typedef struct _IPZ_ZBC_EXPOSURE_STATUS
{
    SW_BOOL         bEnIris;
    SW_BOOL         bAutoIris;
    SW_BOOL         bSnsShutDly;            /* different sensor diff value */
    SW_BOOL         bZoomPosChanged;
    SW_UINT32       u32IrisPercent;    
    SW_UINT32       au32HoldValue[5];       /* 0:close, 1:down, 2:hold, 3:up, 4:open */
    SW_UINT32       u32FluxMin;
    SW_UINT32       u32FluxTypical;
    SW_UINT32       u32FluxMax;
    SW_UINT32       u32FluxTag;
    SW_UINT32       u32FluxError;
    SW_UINT32       u32FluxTagUp;
    SW_UINT32       u32FluxTagDown;
    SW_UINT32       u32FluxPre;

    /* tmp control data */
    SW_UINT32       u32TimeFlux;
    SW_UINT32       u32TimeFluxPre;
    SW_UINT32       u32TimeAveLum;
    SW_UINT32       u32TimeAveLumDly;
    SW_UINT32       u32UpDly;
    SW_UINT32       u32DownDly;
    SW_UINT32       u32HoldDly;
    SW_UINT32       u32ReCalibDly;
    SW_UINT32       u32CtrlDly;
    SW_UINT32       u32CtrlDlyUnit;
    SW_UINT32       u32FrameCnt;
    SW_UINT32       u32FrameCntPre;
    SW_UINT32       u32CalibDlyUnit;
    SW_UINT32       au32PreExposure[5];
    SW_BOOL         bCalibSucc;
    
    SW_BOOL         bCalibFirstCtrl;
    IPZ_ZBC_EXPOSURE_IRIS_STATUS enIrisStat;
    IPZ_ZBC_EXPOSURE_IRIS_STATUS enIrisStatPre;

    SW_UINT32 u32ZoomPos;           /**< Current zoom position */
    SW_UINT32 u32ZoomRatio;         /**< Zoom ratio U22Q10*/
    SW_UINT32 u32LumRatio;    		/**< Luminance ratio linear U22Q10 */
   // SW_UINT32 u32IrisLowLight;    /**< Iris max for low light */
    SW_UINT32 u32SharpenRatio;		/**< Sharpen ratio linear U22Q10 */
    SW_INT32  s32LdcRatio; 
    SW_UINT32 u32DltaFlux;
   // SW_UINT32       u32PrePwmValue;
    
    SW_UINT32       u32AeComp;

    SW_BOOL         bNeedRestore;
    ot_isp_exposure_attr stExpAttr;

    IPZ_ZBC_WDR_MODE      enWdrModePre;
    SW_BOOL         bDebug;

    SW_UINT32       u32ZoomPosPre[2];
    SW_BOOL         bLowLightIris;
    SW_BOOL         bUseLowLightIrisOffset;
    SW_UINT32       u32LowLightLevel;
    SW_UINT32       u32LowLightIrisOffset;
    SW_UINT32       u32LowLightSysGain[5];  /* iris range limited system gain */  
    SW_UINT32       u32FluxGainLevel;
    SW_BOOL         bLowLightPriorMode;
    SW_UINT32       u32LowLightLevelCount;

}IPZ_ZBC_EXPOSURE_STATUS;


typedef struct _IPZ_ZBC_EXPOSURE_CTX
{
    SW_MUTEX hExposureMutex;
    IPZ_ZBC_EXPOSURE_STATUS stStatus;
    IPZ_ZBC_EXPOSURE_ATTR stAttr;
}IPZ_ZBC_EXPOSURE_CTX;


SW_RET IPZ_ZBC_IRIS_Task(void);
SW_RET IPZ_ZBC_EXPOSURE_LensInit(void);
SW_INT IPZ_ZBC_T2TrigHiAe(void);
SW_INT IPZ_ZBC_T2StopHiAe(void);
SW_INT IPZ_ZBC_T2StartHiAe(void);
SW_RET IPZ_ZBC_IRIS_EnableDebug(SW_BOOL bDebug);
SW_RET IPZ_ZBC_IRIS_EnIris(SW_BOOL bDebug);
SW_UINT32 IPZ_ZBC_IRIS_SetStep(SW_UINT32 u32FluxStep,SW_UCHAR lensType);

#endif